<?php

namespace Sffi\ElementPlus\ElSearch;

use Sffi\ElementPlus\entity\Option;
use Sffi\ElementPlus\entityTrait\SelectOption;

class ElSelect extends Item
{
    use SelectOption;
    protected string $type = 'select';
    protected string $placeholder;

    public function __construct(string $title, string $key, string $dataKey, int $width = 120)
    {
        parent::__construct($title, $key, $dataKey, $width);
    }

    public function addOptionByArgs(string $key, string $value,bool $disabled=false, $children=[])
    {
        return $this->addOption(new Option($key, $value, $disabled, $children));
    }

    /**
     * @return string
     */
    public function getPlaceholder(): string
    {
        return $this->placeholder;
    }

    /**
     * @param string $placeholder
     */
    public function setPlaceholder(string $placeholder): void
    {
        $this->placeholder = $placeholder;
    }
}